Vue.filter('cutString', function (value,len) 
{
    if(value.length > len)
    {
    		return value.substring(0,len)+"..";
    }
    else
    {
    		return value;
    }
});

function getZeros(p_len)
{
	var str = "";
	var i = 0;
	for(i=0;i<p_len;i++)
	{
		str += "0";
	}
	return str;
}

Vue.filter('cutDadixPoint', function (value,p_len) 
{
	value = value+"";
	var iPos = value.indexOf("\.");
	if(iPos == -1)
	{
		return value + "." + getZeros(p_len); 
	}
	
	var iLeftLen = value.length - iPos;
	if(iLeftLen > p_len)
	{
		return value.substring(0,iPos+p_len+1);
	}
	else
	{
		return value + getZeros(p_len-iLeftLen+1);
	}
});



Vue.filter('orderStatus', function (value) 
{
    switch(value)
    {
    		case 0:
    		   return "待支付";
    		   break;
    		case 1:
    		   return "待确认";
    		   break;   
    		case 12:
    		   return "待配送确认";
    		   break;   
    		case 2:
    		   return "待取货";
    		   break;
    		   
    		case 21:
    		   return "配送中";
    		   break; 
    		   
    		case 3:
    		   return "送达,待评价";
    		   break;
    		   
    		case 4:
    		   return "待互评";
    		   break;   
    		   
    		case 5:
    		   return "已完成";
    		   break; 
    		
    		case 50:
    		   return "客户取消订单";
    		   break;   
    		
    		case 51:
    		   return "店家取消订单";
    		   break;   
    		   
		case 52:
		  return "无人配送取消订单";
		  break;  
		  
		case 53:
		  return "配送取消订单";
		  break;  		  

		case 54:
		  return "系统取消订单";
		  break;
		  
		case 58:
		  return "店家超时未接单取消订单";
		  break;
		  
		case 59:
		  return "未支付订单超时取消";
		  break;
    }
});

Vue.filter('billtype', function (value) 
{
    switch(value)
    {
    		case 1:
    		   return "订单";
    		   break;   
    		case 2:
    		   return "退款";
    		   break;   
    		case 3:
    		   return "提现";
    		   break;
    		   
    		case 4:
    		   return "充值";
    		   break; 
    		   
    		case 5:
    		   return "罚款";
    		   break;
    		   
    		case 6:
    		   return "其他";
    		   break;   
    		
    }
});

Vue.filter('formattime', function (value,p_type) 
{
	var iYear = value.year+1900;
    var iMonth = value.month+1;
    if(iMonth > 12)
    {
    		iMonth = 1;
    }
	
	var strRet = "";
	if(p_type == "fulltime")
	{
		
		strRet = iYear+"-"+iMonth+"-"+value.date+" "+value.hours+":"+value.minutes+":"+value.seconds;
	}
	
	if(p_type == "noyear")
	{
		strRet = iMonth+"-"+value.date+" "+value.hours+":"+value.minutes+":"+value.seconds;
	}
	
	if(p_type == "noyearsecond")
	{
		strRet = iMonth+"-"+value.date+" "+value.hours+":"+value.minutes;
	}
	return strRet;
});

Vue.filter('orderRefundStatus', function (value) 
{
    switch(value)
    {
    		case 0:
    		   return "申请退款";
    		   break;   
    		case 1:
    		   return "已退款";
    		   break;   
    		case 2:
    		   return "已驳回";
    		   break;
    		
    }
});
